import javaService from '../javaHttp'

export function getData(data) {
  return javaService({
    url: '/naturalgasGateStation/getByCondition',
    method: 'get',
    params: data
  })
}
// 站点设备添加
export function addEquipment(data) {
  return javaService({
    url: '/naturalgasEquipment/addEquipment',
    method: 'post',
    params: handel(data)
  })
}
// 站点设备
export function getEquipmentData(data) {
  return javaService({
    url: '/naturalgasEquipment/getByCondition',
    method: 'get',
    params: data
  })
}

export function saveOrUpdate(data) {
  return javaService({
    url: '/naturalgasGateStation/saveOrUpdate',
    method: 'post',
    data: handel(data)
  })
}
// 站点设备修改
export function equipmenUpdate(data) {
  return javaService({
    url: '/naturalgasEquipment/equipmenUpdate',
    method: 'post',
    data: handel(data)
  })
}
// 数据下拉列表
export function gateStationListById(data) {
  return javaService({
    url: '/naturalgasDashboard/getByGateStationId',
    method: 'get',
    params: data
  })
}
// 存储调整仪表盘显示的设备
export function saveDashboardEquipment(data) {
  return javaService({
    url: '/naturalgasDashboard/saveDashboardEquipment',
    method: 'post',
    data: handel(data)
  })
}
// 下拉框赋值
export function getNaturalgasDashboardByGateStationId(data) {
  return javaService({
    url: '/naturalgasDashboard/getNaturalgasDashboardByGateStationId',
    method: 'get',
    params: data
  })
}
// 修改站点数据回显
export function gateStationById(data) {
  return javaService({
    url: '/naturalgasGateStation/gateStationById',
    method: 'get',
    params: data
  })
}
function handel(data) {
  var params = new URLSearchParams()
  for (const key in data) {
    params.append(key, data[key])
  }
  return params
}
